package com.nescafe.nescafepromo.entity;

import java.lang.reflect.Type;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

public enum EntityType {

	PARTICIPANT(Participant.class, "Participant"), PURCHASE(Purchase.class, "Purchase"),

	TOTAL_POINTS(TotalPoints.class, "TotalPoints"), EXTRA_POINT(ExtraPoint.class, "ExtraPoint");

	private Type classType = null;
	private String kind = null;

	private EntityType(Type classType, String kind) {
		this.classType = classType;
		this.kind = kind;
	}

	public Type getClassType() {
		return classType;
	}

	public String getKind() {
		return kind;
	}

	public Key getKey(long id) {
		return KeyFactory.createKey(kind, id);
	}

	public Key getKey(String id) {
		return KeyFactory.createKey(kind, id);
	}

	public Key getKey(Key parent, String id) {
		return KeyFactory.createKey(parent, kind, id);
	}

	public Key getKey(Key parent, int id) {
		return KeyFactory.createKey(parent, kind, id);
	}
}
